<script type="text/javaScript">
    // <![CDATA[    
    
    $(document).ready(function() {
        
        
        $(".del").click(function() {
            var vid = $(this).attr("id");
            vid = vid.substring(3);
            var url = '{$base_url}regulamento/delete?vid='+vid;

            $("#confirmar").css('visibility', 'visible');
            $("#confirmar").dialog({
                modal: true,
                title: "Apagar Epoca",
                buttons: {
                    sim: function() {
                        $( this ).dialog( "close" );
                        window.location.href = url;
                    },
                    nao: function() {
                        $( this ).dialog( "close" );
                        return false;
                                
                    }
                }
            });
            return false;
        });
        
        $(".edit").click(function() {
            $('#state').val(2);
            
            var vid = $(this).attr("id");
            vid = vid.substring(5);
            var url = '{$base_url}epoca/loadAjax';
            
            $.post( url, { vid: vid },
            function( data ) {
                var obj = JSON.parse(data);
                //alert(obj.nome);
                $('#nome').val(obj.nome);
                $('#data_ini').val(obj.data_ini);
                $('#data_fim').val(obj.data_fim);
                $('#vid').val(vid);
                
                $('#novoDiv').dialog({ modal: true, title: "Alterar Epoca" });

            }
        );
             
        });
      
    });
            
    // ]]>
</script>



{if $vazio eq 0}
Lista de Regulamentos esta vazia
{else}


<table id="rounded-corner" summary="2007 Major IT Companies' Profit">
    <thead>
        <tr>
            <th scope="col" class="rounded-company"></th>
            <th scope="col" class="rounded">Epoca</th>
            <th scope="col" class="rounded">Texto</th>
            <th scope="col" class="rounded">Edit</th>
            <th scope="col" class="rounded-q4">Delete</th>
        </tr>
    </thead>
    <tfoot>
        <tr>
            <td colspan="4" class="rounded-foot-left"><em>Fim</em></td>
            <td class="rounded-foot-right">&nbsp;</td>
        </tr>
    </tfoot>
    <tbody>
        {foreach from=$regulamentos key=myId item=i}
        <tr>
            <td><input type="checkbox" name="" /></td>
            <td>{$i.nome}</td>
            <td>{$i.texto}</td>

            <td><a class="edit" id="lista{$i.id}" href="#"><img src="{$template_url}/admin/images/user_edit.png" alt="" title=""/></a></td>
            <td><a class="del" id="del{$i.id}" href="{$base_url}regulamento/delete?vid={$i.id}"><img src="{$template_url}/admin/images/trash.png" alt="" title=""/></a></td>
        </tr>
        {/foreach}

    </tbody>
</table>
{/if}

{if isset($notok)}
<a href="#" class="bt_red"><span class="bt_red_lft"></span><strong>Adicionar</strong><span class="bt_red_r"></span></a>
{else}
<a id="novoUtilA" href="#" class="bt_green"><span class="bt_green_lft"></span><strong>Adicionar</strong><span class="bt_green_r"></span></a>
{/if}

{include file="$rootDir/templates/admin/formRegulamento.tpl.html"} 

<div id="confirmar">
    tem a certeza?
</div>